home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / text / dtp / SendToCED1_1.lha / SendToCygnusED / SendToCygnusED.rexx < prev   
OS/2 REXX Batch file  |  1995-02-05  |  2KB  |  96 lines

  1. /*
  2.    $VER: SendToCygnusEd.rexx 1.1 (05.01.95)
  3.    Copyright 1994-95 kMel, Klaus Melchior
  4.  
  5.    Source adapted from 
  6.      "SendToPageLiner.rexx" Copyright 1994 Soft-Logik Publishing Corporation
  7. */
  8.  
  9. OPTIONS RESULTS
  10. TRACE OFF
  11.  
  12. /* Make sure rexx support is opened */
  13. IF ~SHOW('L','rexxsupport.library') THEN
  14.    CALL ADDLIB('rexxsupport.library',0,-30)
  15.  
  16.  
  17. ADDRESS 'PAGESTREAM'
  18.  
  19. /*** If text is not selected, select the current article ***/
  20. getcursor characterstart sID characterend eID
  21. IF sID = eID THEN 'selecttext all'
  22.  
  23. /*** Export the article to a temp file ***/
  24. 'lockinterface true'
  25. 'exporttext file t:HotLinkedArticle filter ascii textcode PageStream status force'
  26. 'refresh wait'
  27.  
  28. /*** default ***/
  29. preffile = 'PageStream3:SendToCygnusEd.prefs'
  30. invokepath = "Ed"
  31.  
  32. /*** get the path of the invoker ***/
  33. IF OPEN(.ifile, preffile, 'R') THEN DO
  34.     invokepath = READLN(.ifile)
  35.     CALL CLOSE(.ifile)
  36.     askuser='no'
  37. END
  38. ELSE DO
  39.     askuser='yes'
  40. END
  41.  
  42. /*** If the invoker path doesn't exist in the prefs, ask the user where it is ***/
  43. IF ~EXISTS(invokepath) | askuser = 'yes' THEN DO
  44.     GetFile Title "'Please locate ED - the invoker of CygnusEd'" Load File invokepath PosButton 'Ok' NegButton 'Cancel'
  45.     IF RC = 10 THEN SIGNAL Cancel
  46.     invokepath = RESULT
  47.  
  48.     IF OPEN(.ifile, preffile, 'W') THEN DO
  49.         CALL WRITELN(.ifile, invokepath)
  50.         CALL CLOSE(.ifile)
  51.     END
  52.  
  53. END
  54.  
  55. /*** If the invoker didn't exists, alert the user and exit ***/
  56. IF ~EXISTS(invokepath) THEN DO
  57.     ADDRESS 'PAGESTREAM'
  58.     allocarexxrequester '"Send to Editor Error!"' 368 59
  59.     reqhandle = RESULT
  60.     addarexxgadget reqhandle EXIT 286 42 70 label "_Exit"
  61.         Exithandle = RESULT
  62.     addarexxgadget reqhandle TEXT 8 10 352 border none string "'Invoker of CygnusEd could not be found.'"
  63.     doarexxrequester reqhandle
  64.     freearexxrequester reqhandle
  65.     'refresh continue'
  66.     'lockinterface false'
  67.     EXIT
  68. END
  69.  
  70.  
  71. ADDRESS COMMAND invokepath 't:HotLinkedArticle -sticky'
  72.  
  73.  
  74. /*** Update PageStream and exit ***/
  75. Update:
  76.  
  77. ADDRESS 'PAGESTREAM'
  78. 'ScreenToFront'
  79.  
  80. 'inserttext file t:HotLinkedArticle filter ascii textcode PageStream'
  81.  
  82. /*** deselect the text if required ***/
  83. IF sID = eID THEN selecttext none
  84.  
  85. SIGNAL Cancel
  86.  
  87.  
  88. Cancel:
  89. ADDRESS 'PAGESTREAM'
  90. 'refresh continue'
  91. 'lockinterface false'
  92.  
  93. ADDRESS COMMAND 'delete t:HotLinkedArticle'
  94.  
  95. EXIT
  96.